package com.yingside.io.io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestFileOutputStream {
    public static void main(String[] args) {
        FileOutputStream fileOutputStream = null;
        try {
            //输出流-程序往文件输出内容
            //注意，如果没有这个文件的话，会自动帮我们创建文件
            //但是如果没有文件夹，就会直接报错
            fileOutputStream = new FileOutputStream("bb.txt");


            String str = "abcdefghiujklmn";
            byte[] bytes = str.getBytes();

            fileOutputStream.write(bytes);

//            for (int i = 97; i < 123 ; i++) {
//                fileOutputStream.write(i);
//            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
